<?php

class Page_IndexController extends Crb_Controller
{
    public function preDispatch()
   {
        parent::preDispatch();
		//TODO:  Fancy box install
   }
	
    public function indexAction()
    {
        $News = new Page();
        $News = $News->getAll();
        $this->view->News = $News;
        $this->view->Title = "Список страницы";
    } 
    

    public function viewAction()
    {
        $this->view->layout()->setLayout('layout'); 
        $ID = $this->_request->getParam('id',0);
    	$News = new Page();
        $News = $News->getOne($ID);
        
        $Menu = new Menu();
        $menuItem = $Menu->get($News['CategoryID']);
        
        $articleDAO = new Page(); 
        $Articles = $articleDAO->getByCategory($ID);
        
        
        $fileDAO = new File('ostiva');
        $files = $fileDAO->get($ID);
        
        
        $this->view->Articles = $Articles;
        $this->view->menuItem = $menuItem;
        
        $this->view->Row = $News; 
        $this->view->Title = $News['Title'];
        
        $this->view->files = $files;
        
        $this->view->headTitle(" | " . $News['Title']);
        $this->view->headMeta($News['Title'], 'description');
        $this->view->headMeta($News['Title'], 'keywords');
    }    
}

